From f6d2a87f051456bddb7a47922c8cf60f37073063 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 3 Sep 2013 13:41:46 +0100 Subject: [PATCH] libxl: Do not generate short block in libxl__datacopier_prefixdata libxl__datacopier_prefixdata would prepend a deliberately short block (not just a half-full one, but one with a short buffer) to the dc->bufs queue. However, this is wrong because datacopier_readable will find it and try to continue to fill it up. Instead, allocate a full-sized buffer. Signed-off-by: Ian Jackson Tested-by: Chunyan Liu Acked-by: Ian Campbell --- tools/libxl/libxl_aoutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c index 983a60afc7..b4eb6e5284 100644 --- a/tools/libxl/libxl_aoutils.c +++ b/tools/libxl/libxl_aoutils.c @@ -89,7 +89,7 @@ void libxl__datacopier_prefixdata(libxl__egc *egc, libxl__datacopier_state *dc, assert(len < dc->maxsz - dc->used); - buf = libxl__zalloc(NOGC, sizeof(*buf) - sizeof(buf->buf) + len); + buf = libxl__zalloc(NOGC, sizeof(*buf)); buf->used = len; memcpy(buf->buf, data, len); -- 2.30.2